#include "Status.h"


Status::Status(StageParam* stage)
{
	potatoCount=stage->getPotatoCount();
	countdown=stage->getCountdown();
	for(int i = 0; i<10;i++){
		equipment.push_back(false);
		keys.push_back(false);
	}
	currentEquip = NAKED;
}
//RUn when you pick up a key adding it to your keychain
void Status::pickUpKey(Colour key){
	keys[key] = true;
}

bool Status::hasKey(Colour key){
	return keys[key];
}
void Status::removeKey(Colour key){
	keys[key] = false;
}

//Run when you pick up item adding it to your equipment
void Status::pickUpItem(Equip type)
{
	equipment[type] =true;
	if(currentEquip == NAKED)
		equipItem(type);
	
}

bool Status::hasEquip(Equip type){
	return equipment[type];
}

//Returns what Tait's wearing
Equip Status::getCurrentEquip(){
	return currentEquip;
}

//Losing an item from say a theif will drop the item removing it from equipment vector and make you naked
void Status::loseItem(Equip type)
{
	equipment[type] = false;
	for(int i = 0; i<10;i++){
		equipItem((Equip)i);
	}
}

//unequip is uneccessary as we would like if you have an item, to always have at least one item equipped.
void Status::equipItem(Equip type) // W/ FILTER
{
	if(equipment[type]!=false){
		currentEquip = type;
	}
}
//Reduces potatos by 1
void Status::getPotato(){
	potatoCount --;
}

int Status::potatosLeft(){
	return potatoCount;
}

//Removes a second from countdown if necessary
void Status::removeSecond(){
	if(countdown!=0)
	countdown--;
	else
		countdown =0;

	cout<<countdown<<endl;
}
int Status::getCountdown(){
	return countdown;
}
